package com.ocom.netty.mj.client;


import com.ocom.common.constant.SrvpAccessDeviceUrl;
import com.ocom.common.resp.RespMachMessage;
import com.ocom.common.vo.VerifyAccessVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @ProjectName: ocom30
 * @Package: com.ocom.srvshttp.feignclient
 * @ClassName: SrvpAccessDeviceClient
 * @Author: OCOM
 * @Description: 远程调用门禁服务
 * @Date: 2021/12/2 17:06
 * @Version: 3.0
 */
@Component
@FeignClient(name = "srvpaccess")
public interface SrvpAccessDeviceClient {

    //获取设备同步信息标志
    // 获取设备同步信息标志
    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getDeviceFlag)
    RespMachMessage getDeviceFlag(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("versionCode") String versionCode,@RequestParam("commMode") Integer commMode);


    // 获取设备状态（getDeviceState）
    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getDeviceState)
    RespMachMessage getDeviceState(@RequestParam("machNo")String machNo,@RequestParam("versionCode") String versionCode,@RequestParam("commMode") Integer commMode);


    // 获取门禁时区表（getZoneTime）
    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getZoneTime)
    RespMachMessage getZoneTime(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo);


    // 获取权限组参数（getGroupPara）
    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getGroupPara)
    RespMachMessage getGroupPara(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("perGroupNum") Long perGroupNum);

    // 获取权限组参数（getGroupPara）
    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getGroupParaNew)
    RespMachMessage getGroupParaNew(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("perGroupNum") Long perGroupNum);

    //获取白名单
    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getWhiteList)
    String getWhiteList(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("listLimit") Integer listLimit);


    @PostMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_saveAccessRecord)
    RespMachMessage saveAccessRecord(@RequestParam("companyId")Long companyId,@RequestParam("machNo")String machNo,@RequestParam("idnum")Long idnum,@RequestParam("accessTime")String accessTime,@RequestParam("accessMode")Long accessMode);

    // 验证门禁权限（verifyAccess）
    @PostMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_verifyAccess)
    RespMachMessage verifyAccess(VerifyAccessVo verifyAccessVo);

    /**
     *更改时区表状态（changeZoneTimeState）
     * */
    @PostMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_changeZoneTimeState)
    RespMachMessage changeZoneTimeState(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo);

    // 功能二维码（functionQr）
    @PostMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_functionQr)
    RespMachMessage functionQr(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("qrCode") String qrCode);

    // 获取二进制升级文件数据
    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getBinData)
    RespMachMessage getBinData(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("lastBlockNum") Integer lastBlockNum);

    /**
     * （返回结果为成功时调用） 更改白名单状态（ACCESSDEVICE/changeWhiteListState）
     */
    @PostMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_changeWhiteListState)
    RespMachMessage changeWhiteListState(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo);

    /**
     * 更改升级文件数据状态（changeBinDataState）
     * */
    @PostMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_changeBinDataState)
    RespMachMessage changeBinDataState(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("jobId") Long jobId);


    // 更改密钥状态（changeKeyState）
    @PostMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_changeKeyState)
    RespMachMessage changeKeyState(@RequestParam("companyId")Long companyId, @RequestParam("machNo")String machNo,@RequestParam("jobId")String jobId,@RequestParam("deviceType") Integer deviceType);

    @GetMapping(value = SrvpAccessDeviceUrl.URLP_ACCESSDEVICE_getDecodeKey)
    RespMachMessage getDecodeKey(@RequestParam("companyId")Long companyId,@RequestParam("machNo") String machNo,@RequestParam("deviceType") Integer deviceType);
}